<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
        #allmap{height:300px;width:300px;}
        #r-result{width:100%; font-size:14px;}
        #allmap{
            width: 800px;
            height: 500px;
        }
    </style>
    <script type="text/javascript" src="//api.map.baidu.com/api?v=3.0&ak=9uMfplQ31BxCzK4Bj1ndPqcVk3cm389E"></script>
    <title>城市名定位</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("allmap");
    map.centerAndZoom(new BMap.Point(116.331398,39.897445),11);
    map.enableScrollWheelZoom(true);


    // 覆盖区域图层测试
    map.addTileLayer(new BMap.PanoramaCoverageLayer());

    var stCtrl = new BMap.PanoramaControl(); //构造全景控件
    stCtrl.setOffset(new BMap.Size(20, 20));
    map.addControl(stCtrl);//添加全景控件


    // 用经纬度设置地图中心点
    function theLocation(a,b){
            map.clearOverlays();
            var new_point = new BMap.Point(a,b);
            var marker = new BMap.Marker(new_point);  // 创建标注
            map.addOverlay(marker);              // 将标注添加到地图中
        point = new BMap.Point(a,b);
        map.centerAndZoom(point, 15);
            map.panTo(new_point);

    }
</script>